/*
 * Copyright (c) 2010-2013 Ruben Chakhmakhchyan. All rights reserved.
 * 
 * This file contains Original Code and/or Modifications of Original Code
 * as defined in and that are subject to the Eclipse Public License
 * Version 1.0 (the 'License'). You may not use this file except in
 * compliance with the License. Please obtain a copy of the License at
 * http://opensource.org/licenses/EPL-1.0 and read it before using this file.
 */

#pragma once

#include "message_listener.h"


class CEventCallback : public IWiaEventCallback
{
public:

	CEventCallback( MessageListener* messageListener );

	// IUnknown interface

	STDMETHOD(QueryInterface)(REFIID iid, LPVOID *ppvObj);
	STDMETHOD_(ULONG, AddRef)();
	STDMETHOD_(ULONG, Release)();

	// IWiaEventCallback interface

	STDMETHOD(ImageEventCallback)( LPCGUID pEventGuid, BSTR bstrEventDescription, BSTR bstrDeviceID, BSTR bstrDeviceDescription, DWORD dwDeviceType, BSTR bstrFullItemName, ULONG *pulEventType, ULONG ulReserved );

private:

	volatile LONG m_cRef;
	CComPtr<IUnknown> m_pConnectEventObject;
	CComPtr<IUnknown> m_pDisconnectEventObject;

	MessageListener* m_messageListener;
};

